package org.wu.framework.authorization.platform.infrastructure.converter;


import org.wu.framework.authorization.platform.infrastructure.entity.SysUserRoleDO;
import org.wu.framework.authorization.platform.domain.model.sys.user.role.SysUserRole;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter;

/**
 * describe 用户角色关联关系
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyInfrastructureConverter
 **/

public class SysUserRoleConverter {


    /**
     * describe 实体对象 转换成领域对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysUserRole toUserRole(SysUserRoleDO sysUserRoleDO) {
        if (null != sysUserRoleDO) {
            SysUserRole sysUserRole = new SysUserRole();
            sysUserRole.setCreateTime(sysUserRoleDO.getCreateTime());
            sysUserRole.setId(sysUserRoleDO.getId());
            sysUserRole.setIsDeleted(sysUserRoleDO.getIsDeleted());
            sysUserRole.setRoleId(sysUserRoleDO.getRoleId());
            sysUserRole.setUpdateTime(sysUserRoleDO.getUpdateTime());
            sysUserRole.setUserId(sysUserRoleDO.getUserId());
            sysUserRole.setZoneId(sysUserRoleDO.getZoneId());
            return sysUserRole;
        }
        return null;
    }

    /**
     * describe 领域对象 转换成实体对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysUserRoleDO fromUserRole(SysUserRole sysUserRole) {
        if (null != sysUserRole) {
            SysUserRoleDO sysUserRoleDO = new SysUserRoleDO();
            sysUserRoleDO.setCreateTime(sysUserRole.getCreateTime());
            sysUserRoleDO.setId(sysUserRole.getId());
            sysUserRoleDO.setIsDeleted(sysUserRole.getIsDeleted());
            sysUserRoleDO.setRoleId(sysUserRole.getRoleId());
            sysUserRoleDO.setUpdateTime(sysUserRole.getUpdateTime());
            sysUserRoleDO.setUserId(sysUserRole.getUserId());
            sysUserRoleDO.setZoneId(sysUserRole.getZoneId());
            return sysUserRoleDO;
        }
        return null;
    }

}